///
/// $Id: cmain.h,v 1.5 2005/10/26 06:39:14 olegus Exp $
///

#ifndef _cmain_
#define _cmain_

#define _USE_MATH_DEFINES

#include <math.h>
#include <limits.h>
#include <float.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <map>
#include <string>

using namespace std;

//#define _FINAL

#undef  for
#define for if(0) {} else for

#define SafeDelete(x) if( (x) == NULL ) {} else { delete (x); (x) = NULL; }
#define SafeDeleteArray(x) if( (x) == NULL ) {} else { delete[] (x); (x) = NULL; }

#define EQUFLT long double

void AssertFailed( const char*, ... );

#ifndef _FINAL
    #define Assert( expr )                                                  \
        if( expr ){} else                                                   \
            AssertFailed("Assert failed: %s, %s, %s %i\n",                  \
                      #expr, __FILE__, __FUNCTION__, __LINE__ )
#else
    #define Assert( expr )
#endif

#define max(a,b) (a>b?a:b)
#define min(a,b) (a>b?b:a)

#define intlen(a) _scprintf( "%i", (int)a )

bool valid( EQUFLT d );

typedef char Name_t[32];
typedef char Text_t[1024];

#endif

///
/// $Id: cmain.h,v 1.5 2005/10/26 06:39:14 olegus Exp $
///

